//
//  SVGRect.m
//  Shake and Bake
//
//  Created by Antoine Quint on 10/08/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "SVGRect.h"

@implementation SVGRect

- (id)initWithAttributeDict:(NSDictionary *)attributesDict andView:(Canvas *)aView
{
  [super initWithAttributeDict:attributesDict andView:aView];
	if (self) {
		// parse attribute values
		x = [[attributes objectForKey:@"x"] floatValue];
		y = [[attributes objectForKey:@"y"] floatValue];
		width = [[attributes objectForKey:@"width"] floatValue];
		height = [[attributes objectForKey:@"height"] floatValue];
		//
		self.position = CGPointMake(x - (strokeWidth / 2), y - (strokeWidth / 2)); 
		self.bounds = CGRectMake(0.0f, 0.0f, width + strokeWidth, height + strokeWidth);
		self.name = @"rect";
	}
	return self;
}

- (void)makePath:(CGContextRef)context
{
	CGContextAddRect(context, CGRectMake(strokeWidth / 2, strokeWidth / 2, width, height));
}

@end
